﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="AddNew.aspx.cs" Inherits="Enterprise.UI.Web.Modules.WebEmail.AddNew" ValidateRequest="false" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
    <link rel="stylesheet" type="text/css" href="../../Styles/css/ssec-form.css"/> 
    <script charset="utf-8" src="../../kindeditor-4.1.1/kindeditor-min.js" type="text/javascript"></script>    
    <script charset="utf-8" src="../../kindeditor-4.1.1/lang/zh_CN.js" type="text/javascript"></script>
    <script type="text/javascript" src="../EntDisk/Script/swfupload.js"></script>
    <script type="text/javascript" src="../EntDisk/Script/swfupload.queue.js"></script>
    <script type="text/javascript" src="../EntDisk/Script/fileprogress.js"></script>
    <script type="text/javascript" src="../EntDisk/Script/handlers.js"></script>
    <script type="text/javascript">
        var editor;
        KindEditor.ready(function (K) {
            editor = K.create('textarea[id="tb_content"]', {
                resizeType: 1,
                allowPreviewEmoticons: false,
                allowImageUpload: false,
                items: [
						'fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
						'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
						'insertunorderedlist', '|', 'image', 'link']
            });
        });


        var swfu;

        window.onload = function () {
            var settings = {
                flash_url: "../EntDisk/Script/Swf/swfupload.swf",
                upload_url: "Upload.ashx?path=<%=filePath %>",
                post_params: { "ASPSESSID": "<%=Session.SessionID %>" },
                file_size_limit: "100 MB",
                file_types: "*.*",
                file_types_description: "所有文件",
                file_upload_limit: 100,
                file_queue_limit: 0,
                custom_settings: {
                    progressTarget: "fsUploadProgress",
                    cancelButtonId: "btnCancel"
                },
                debug: false,

                // Button settings
                button_image_url: "../EntDisk/Content/Img/XPButtonNoText_160x22.png",
                button_width: "160",
                button_height: "22",
                button_placeholder_id: "spanButtonPlaceHolder",
                button_text: '选择附件..',
                button_text_style: ".button { font-family: Helvetica, Arial, sans-serif; font-size: 14pt; } .buttonSmall { font-size: 10pt; }",
                button_text_left_padding: 5,
                button_text_top_padding: 1,

                // The event handler functions are defined in handlers.js
                file_queued_handler: fileQueued,
                file_queue_error_handler: fileQueueError,
                file_dialog_complete_handler: fileDialogComplete,
                upload_start_handler: uploadStart,
                upload_progress_handler: uploadProgress,
                upload_error_handler: uploadError,
                upload_success_handler: uploadSuccess,
                upload_complete_handler: uploadComplete,
                queue_complete_handler: queueComplete	// Queue plugin event
            };
            swfu = new SWFUpload(settings);
        };
        function uploadComplete(fileObj, serverdata) {
            var id = "f" + fileObj.index;
            $('#attch_list').append("<span id='" + id + "'><p style='float:left;hight:16px;'>" + fileObj.name + "|</p><a style='float:left;hight:16px;' href='#' onclick='delfile(\"" + id + "\")' style='color:red'>删除</a></span>");
            //$('attch_list_value').attr("value", "<span id='" + id + "'>" + fileObj.name + "<a href='#' onclick='delfile(\"" + id + "\")' style='color:red'> 删除 </a></span>");
            $('#attch_list_value').attr("value", $('#attch_list p').text());
            //alert($('#attch_list p').text());
        }
        function delfile(id) {
            $('#' + id).remove();
            $('#attch_list_value').attr("value", $('#attch_list p').text());           
        }
    </script>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainPH" runat="server">
    <div class="toolbars">       
       <a href="Inbox.aspx"  class="easyui-linkbutton" iconCls="icon-toolbar" plain="true">收件箱</a>
       <a href="OutBox.aspx"  class="easyui-linkbutton" iconCls="icon-toolbar" plain="true">发件箱</a>
       <a href="AddNew.aspx"  class="easyui-linkbutton" iconCls="icon-toolbar" plain="true">写邮件</a>
       <a href="Setting.aspx"  class="easyui-linkbutton" iconCls="icon-toolbar" plain="true">邮箱设置</a>              
   </div> 
   <div id="contents" class="ssec-form">
   <div class="ssec-group ssec-group-hasicon"><img src="../../easyui1.2.6/themes/icons/application.png" alt=""/>发送邮件</div>
    <ul>
        <li><div class="ssec-label">发件人地址：</div></li>
        <li><div class="ssec-text large"><asp:TextBox ID="tb_from" runat="server" CssClass="ssec-text-field" Enabled="false"></asp:TextBox></div></li>        
   </ul>
   <ul>
        <li><div class="ssec-label">收件人地址：</div></li>
        <li><div class="ssec-text large"><asp:TextBox ID="tb_to" runat="server" CssClass="ssec-text-field easyui-validatebox"  required="true" missingMessage="该项必须填写"></asp:TextBox></div>多个地址请用 ; 隔开</li>        
   </ul>
    <ul>
        <li><div class="ssec-label">抄送：</div></li>
        <li><div class="ssec-text large"><asp:TextBox ID="tb_cc" runat="server" CssClass="ssec-text-field easyui-validatebox"></asp:TextBox></div>多个地址请用 ; 隔开</li>        
   </ul>
   <ul>
        <li><div class="ssec-label">主题：</div></li>
        <li><div class="ssec-text large"><asp:TextBox ID="tb_subject" runat="server" CssClass="ssec-text-field"></asp:TextBox></div></li>        
   </ul>
   <ul>
        <li style="width:100%;"><asp:TextBox ID="tb_content" ClientIDMode="Static" TextMode="MultiLine" runat="server" CssClass="easyui-validatebox" Width="99%"></asp:TextBox></li>
   </ul>
   <ul>
        <li><div class="ssec-label">附件：</div></li>
        <li><div id="attch_list" ></div><asp:HiddenField ID="attch_list_value" runat="server" ClientIDMode="Static" />
        </li>
   </ul>   
   <ul>
        
        <li>
            <div id="fsUploadProgress">
                <span class="legend"></span>
            </div>
            <div id="divStatus" style="display:none">
            </div>
            <div>
            <span id="spanButtonPlaceHolder"></span></div><div style="float:left"><input id="btnCancel" type="button"
            value="取消所有上传" onclick="swfu.cancelQueue();" disabled="disabled" class="button2" />
    </div>
        </li>        
   </ul>
   <div class="ssec-group-bottom ssec-group-hasicon">
   <asp:LinkButton ID="btn_Send" runat="server" CssClass="easyui-linkbutton" 
           onclick="btn_Send_Click" OnClientClick="editor.sync();return $('#form1').form('validate');">发送邮件</asp:LinkButton>
   </div>   
  
   </div>  
</asp:Content>
